var express = require("express");
var router = express.Router();
// 配置图片上虚拟路由
router.use("/upload", express.static("upload"));

// 上传图片
router.post('/myupload', (req, res) => {
    let form = new multiparty.Form()
    form.uploadDir = 'upload'
    form.parse(req, (err, formData, imgData) => {
      // 将上传的图片传递给前端
      res.send({
        path: imgData.file[0].path
      })
    })
  })  



module.exports = router;
